<script lang="ts">
	import { page } from '$app/state';

	const code = page.url.searchParams.get('code') ?? '';
	const from = page.url.searchParams.get('from') ?? '';

	if (window.parent != undefined) {
		window.parent.postMessage(
			{
				type: 'WxLogin',
				code: code
			},
			from
		);
	}
</script>
